﻿using System;

namespace Lt.Workflow
{
    public class CustomActionWorkflowItem : WorkflowItem
    {
        private readonly Action<object[]> customAction;

        public CustomActionWorkflowItem(Action<object[]> customAction)
        {
            this.customAction = customAction;
        }

        public override void Run(params object[] args)
        {
            this.customAction(args);
        }

        public override bool Validate(bool throwException = false)
        {
            return customAction != null;
        }
    }
}